<template>
  <div class="admin">
    <div class="admin_header">
      <div class="logo_box">
        <img src="@/assets/img/logo.png" alt class="logo" />
      </div>
      <div class="user_info">
        <el-dropdown>
          <span class="el-dropdown-link" style="color:#fff;cursor:pointer">
            Admin
            <i class="el-icon-arrow-down el-icon--right"></i>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item>消息中心</el-dropdown-item>
            <el-dropdown-item>
              <span @click="goHome">返回官网</span>
            </el-dropdown-item>
            <el-dropdown-item>退出登陆</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
    </div>

    <!-- 下部分 -->
    <div class="center">
      <div class="sider">
        <Sider />
      </div>
      <div class="main">
        <div class="header">
          <div class="line"></div>
          {{cur_title || '中电云网'}}
        </div>
        <div class="content">
          <router-view />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Sider from "@/components/CmsCmp/Sider";
export default {
  components: {
    Sider
  },
  data() {
    return {
      transitionName: ""
    };
  },

  computed: {
    // 使用cookie记录当前路由 防止刷新菜单跟页面不匹配
    // activeIndex() {
    //   const cIndex = getStorage("activeIndex");
    //   if (cIndex) return cIndex;
    //   else return "0";
    // },
    cur_title() {
      
      const cur = this.$route.meta.title;

      return  cur
    },
    current_title() {
      // let routes = this.$router.options.routes;
      // console.log(routes[2].children);
    }
  },
  mounted() {
    // let routes = this.$router.options.routes;
    console.log(this.$route);
    document.title = "中电云网-控制台";
  },
  methods: {
    goHome() {
      console.log(111);
      this.$router.replace({ path: "/" });
    }
  }
};
</script>

<style lang="less" scoped>
.admin {
  // padding-top: 60px;
  min-width: 1000px;
  width: 100%;
  height: 100%;
  position: relative;
  left: 0;
  top: 0;
  // background-color: #f5f5f5;
  display: flex;
  flex-direction: column;
}

.admin_header {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 60px;
  background-color: #3963bc;
  .logo_box {
    display: flex;
    align-items: center;
    color: #fff;
    span {
      margin-left: 10px;
      font-size: 20px;
      font-weight: 400;
      letter-spacing: 2px;
    }
  }
  .logo {
    height: 50px;
  }
  .user_info {
    color: #fff;
  }
}

.center {
  padding-left: 200px;
  padding-top: 116px;
  width: 100%;
  display: flex;

  .sider {
    padding-top: 60px;
    position: fixed;
    left: 0;
    top: 0;
    width: 200px;
    height: 100%;
    background-color: #fff;
    border-right: 1px solid #eee;
    overflow: hidden;
  }
  .main {
    flex: 1;
    height: 100%;
    .content {
      height: 100%;
      padding: 10px;
    }
    .header {
      width: 100%;
      height: 56px;
      padding: 0 20px;
      display: flex;
      align-items: center;
      background-color: #fff;
      border-bottom: 1px solid #eee;
      font-weight: 800;
      position: fixed;
      left: 200px;
      top: 60px;
      z-index: 1000;
      .line {
        width: 4px;
        height: 20px;
        background-color: #3963bc;
        margin-right: 10px;
      }
    }
  }
}
</style>